﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};

	var auditData = Jxstar.findComboData('audit');
	var moneytypeData = Jxstar.findComboData('moneytype');
	var authtypeData = Jxstar.findComboData('authtype');
	var process_stateData = Jxstar.findComboData('process_state');

	var cols = [
	{col:{header:'记录状态', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: auditData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: auditData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < auditData.length; i++) {
				if (auditData[i][0] == value)
					return auditData[i][1];
			}
		}}, field:{name:'project_process__auditing',type:'string'}},
	{col:{header:'项目编码', width:99, sortable:true, editable:false,
		editor:new Ext.form.TriggerField({
			maxLength:20,
			myeditable:false,
			triggerClass:'x-form-search-trigger', 
			onTriggerClick: function() {
				var selcfg = {pageType:'combogrid', nodeId:'project_select', layoutPage:'', sourceField:'', targetField:'', whereSql:"", whereValue:'', whereType:'', isSame:'1', isShowData:'1', isMoreSelect:'0',isReadonly:'1',fieldName:'project_process.project_code'};
				JxSelect.createSelectWin(selcfg, this, 'node_project_processchg_editgrid');
			}
		})}, field:{name:'project_process__project_code',type:'string'}},
	{col:{header:'项目名称', width:215, sortable:true}, field:{name:'project_process__project_name',type:'string'}},
	{col:{header:'实施单位', width:115, sortable:true}, field:{name:'project_process__dept_name',type:'string'}},
	{col:{header:'项目类型', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: moneytypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: moneytypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < moneytypeData.length; i++) {
				if (moneytypeData[i][0] == value)
					return moneytypeData[i][1];
			}
		}}, field:{name:'project_process__money_type',type:'string'}},
	{col:{header:'授权形式', width:100, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: authtypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: authtypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < authtypeData.length; i++) {
				if (authtypeData[i][0] == value)
					return authtypeData[i][1];
			}
		}}, field:{name:'project_process__auth_type',type:'string'}},
	{col:{header:'计划金额(万元)', width:100, sortable:true, renderer:JxUtil.formatNumber(6)}, field:{name:'project_process__plan_money',type:'float'}},
	{col:{header:'项目负责人', width:100, sortable:true}, field:{name:'project_process__project_user',type:'string'}},
	{col:{header:'是否调整', width:100, sortable:true, hidden:true}, field:{name:'project_process__is_turn',type:'string'}},
	{col:{header:'项目论证完成时间', width:122, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'project_process__date_projectlz',type:'date'}},
	{col:{header:'招投标完成时间', width:100, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'project_process__date_ztb',type:'date'}},
	{col:{header:'合同签订完成时间', width:127, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'project_process__date_contract',type:'date'}},
	{col:{header:'施工完成时间', width:100, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'project_process__date_projectend',type:'date'}},
	{col:{header:'单项验收计划完成时间', width:140, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'project_process__date_checkone',type:'date'}},
	{col:{header:'内部验收完成时间', width:119, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'project_process__date_check',type:'date'}},
	{col:{header:'竣工审计财务决算时间', width:148, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'project_process__date_moneycheck',type:'date'}},
	{col:{header:'竣工验收计划完成时间', width:134, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.DateField({
			format: 'Y-m',
			minValue: '1900-01-01'
		}),
		renderer:function(value) {
			return value ? value.format('Y-m') : '';
		}}, field:{name:'project_process__date_checkend',type:'date'}},
	{col:{header:'备注', width:214, sortable:true, editable:true, hcss:'color:#3039b4;',
		editor:new Ext.form.TextField({
			maxLength:200
		})}, field:{name:'project_process__memo',type:'string'}},
	{col:{header:'计划属性', width:100, sortable:true, hidden:true, align:'center',
		renderer:function(value){
			for (var i = 0; i < process_stateData.length; i++) {
				if (process_stateData[i][0] == value)
					return process_stateData[i][1];
			}
		}}, field:{name:'project_process__process_state',type:'string'}},
	{col:{header:'编制人', width:100, sortable:true}, field:{name:'project_process__proecss_user',type:'string'}},
	{col:{header:'编制时间', width:100, sortable:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_process__proecss_date',type:'date'}},
	{col:{header:'主管部门', width:100, sortable:true, hidden:true}, field:{name:'project_process__done_deptname',type:'string'}},
	{col:{header:'部门ID', width:100, sortable:true, hidden:true}, field:{name:'project_process__dept_id',type:'string'}},
	{col:{header:'主键', width:100, sortable:true, hidden:true}, field:{name:'project_process__process_id',type:'string'}},
	{col:{header:'项目ID', width:100, sortable:true, hidden:true}, field:{name:'project_process__project_id',type:'string'}},
	{col:{header:'主管部门ID', width:100, sortable:true, hidden:true}, field:{name:'project_process__done_deptid',type:'string'}},
	{col:{header:'是否结转', width:100, sortable:true, hidden:true}, field:{name:'project_process__has_turn',type:'string'}},
	{col:{header:'立项日期', width:100, sortable:true, hidden:true, renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'project_process__project_checkdate',type:'date'}},
	{col:{header:'项目负责人ID', width:100, sortable:true, hidden:true}, field:{name:'project_process__project_userid',type:'string'}},
	{col:{header:'编制人ID', width:100, sortable:true, hidden:true}, field:{name:'project_process__proecss_userid',type:'string'}},
	{col:{header:'批复单位', width:100, sortable:true, hidden:true}, field:{name:'project_process__check_dept',type:'string'}},
	{col:{header:'原计划ID', width:100, sortable:true, hidden:true}, field:{name:'project_process__process_oldid',type:'string'}},
	{col:{header:'计划批复文号', width:100, sortable:true, hidden:true}, field:{name:'project_process__check_fileno',type:'string'}}
	];
	
	config.param = {
		cols: cols,
		sorts: null,
		hasQuery: '1',
		isedit: '1',
		isshow: '1',
		funid: 'project_processchg'
	};
	
	config.eventcfg = {		selectProcess: function(){			//记录目标表格，选择记录后刷新用			var destGrid = this.grid;					//过滤条件			//显示计划属性是 新计划，并且已提交（审批通过的auditing是3）的进度计划			var where_sql = "process_state = '1' and project_code not in ( select project_code from project_process where process_state ='0' ) ";			var where_type = '';			var where_value = '';						//加载数据			var hdcall = function(grid) {				//显示数据				JxUtil.delay(500, function(){										//保存目标表格					grid.destGrid = destGrid;					grid.on('beforedestroy', function(gp){						gp.destGrid = null; delete gp.destGrid;						gp = null;						return true;					});									//设置外键值					grid.fkValue = where_value;					Jxstar.loadData(grid, {where_sql:where_sql, where_value:where_value, where_type:where_type});				});			};			//显示数据			var define = Jxstar.findNode('project_processquery');			Jxstar.showData({				filename: define.gridpage, //这个地方是 define.gridpage 才能正常加载				title: define.nodetitle,				pagetype: 'selgrid',				nodedefine: define,				callback: hdcall			});		}	};
		
	return new Jxstar.GridNode(config);
}